package cn.edu.gdut.deepcode.utils;

import cn.edu.gdut.deepcode.ws.pojo.ResultMessage;
import com.alibaba.fastjson.JSON;

/**
 * <p>
 * 使用WebSocket开启协同编辑功能
 * </p>
 *
 * @Author: myc
 * @Since: 2025-04-14  22:54
 * @Version: 1.0.0
 */
public class MessageUtils {
    public static String getMessage(boolean isSystemMessage, String fromUser, Object message) {
        ResultMessage result = new ResultMessage();
        result.setSystemMessage(isSystemMessage);
        result.setMessage(message);
        if (fromUser != null) {
            result.setFromUser(fromUser);
        }
        return JSON.toJSONString(result);
    }
}
